package com.reny.szkj.mvvmarts

import android.app.Application
import android.content.Context
import com.reny.git.imgload.glide.ImgUtils
import com.reny.ll.git.base_logic.DIFace
import com.reny.ll.git.base_logic.init
import com.reny.ll.git.base_logic.onBaseTerminate
import com.reny.ll.git.core.App
import com.reny.szkj.mvvmarts.glide.GlideAppLoader
import org.kodein.di.DI
import org.kodein.di.android.x.androidXModule
import org.kodein.di.bind
import org.kodein.di.singleton

class MyApp : Application(), DIFace {

    override val mdi: DI.MainBuilder.() -> Unit
        get() = {
            bind<Context>() with singleton { this@MyApp }
            //import(androidModule(this@MyApp))
            import(androidXModule(this@MyApp))
        }

    override fun onCreate() {
        super.onCreate()
        App.isDebug = BuildConfig.DEBUG
        ImgUtils.instance.initLoader(GlideAppLoader())
        init()
    }

    override fun onTerminate() {
        super.onTerminate()

        onBaseTerminate()
    }

}